/* Copyright (c) 2004-2024 peigen.info. All rights reserved. */

package info.peigen.hotpot.business.account.manage.convertor;

import cn.hutool.core.bean.BeanUtil;
import info.peigen.hotpot.business.account.core.domain.account.AccountLog;
import info.peigen.hotpot.business.account.core.repository.entity.AccountLogEntity;
import info.peigen.hotpot.business.account.manage.form.AccountLogManageCreateForm;
import info.peigen.hotpot.business.account.manage.form.AccountLogManageEditForm;
import info.peigen.hotpot.business.account.manage.form.AccountLogManageSearchForm;
import info.peigen.hotpot.business.account.manage.info.AccountLogManageInfo;
import info.peigen.hotpot.common.core.util.IdUtil;
import lombok.extern.slf4j.Slf4j;

/**
 * <b>(AccountLogManageConvertor)</b>
 * 管理后台领域对象 "账户流水记录" 转换器
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2023-08-29
 */
@SuppressWarnings("unused")
@Slf4j
public class AccountLogManageConvertor {
    // ConvertToEntity
    public static AccountLogEntity convertToEntity(AccountLog domain) {
        return BeanUtil.copyProperties(domain, AccountLogEntity.class);
    }

    public static AccountLogEntity convertToEntity(AccountLogManageInfo info) {
        return BeanUtil.copyProperties(info, AccountLogEntity.class);
    }

    public static AccountLogEntity convertToEntity(AccountLogManageSearchForm form) {
        return BeanUtil.copyProperties(form, AccountLogEntity.class);
    }

    public static AccountLogEntity convertToEntity(AccountLogManageCreateForm form) {
        if (form.getAccountLogId() == null) {
            form.setAccountLogId(IdUtil.id());
        }
        return BeanUtil.copyProperties(form, AccountLogEntity.class);
    }

    public static AccountLogEntity convertToEntity(AccountLogManageEditForm form) {
        return BeanUtil.copyProperties(form, AccountLogEntity.class);
    }

    // ConvertToDomain
    public static AccountLog convertToDomain(AccountLogEntity entity) {
        return BeanUtil.copyProperties(entity, AccountLog.class);
    }

    public static AccountLog convertToDomain(AccountLogManageInfo info) {
        return BeanUtil.copyProperties(info, AccountLog.class);
    }

    public static AccountLog convertToDomain(AccountLogManageSearchForm form) {
        return BeanUtil.copyProperties(form, AccountLog.class);
    }

    public static AccountLog convertToDomain(AccountLogManageCreateForm form) {
        if (form.getAccountLogId() == null) {
            form.setAccountLogId(IdUtil.id());
        }
        return BeanUtil.copyProperties(form, AccountLog.class);
    }

    public static AccountLog convertToDomain(AccountLogManageEditForm form) {
        return BeanUtil.copyProperties(form, AccountLog.class);
    }

    // convertToInfo
    public static AccountLogManageInfo convertToInfo(AccountLog domain) {
        return BeanUtil.copyProperties(domain, AccountLogManageInfo.class);
    }

    public static AccountLogManageInfo convertToInfo(AccountLogEntity entity) {
        return BeanUtil.copyProperties(entity, AccountLogManageInfo.class);
    }

    public static AccountLogManageInfo convertToInfo(AccountLogManageSearchForm form) {
        return BeanUtil.copyProperties(form, AccountLogManageInfo.class);
    }

    public static AccountLogManageInfo convertToInfo(AccountLogManageCreateForm form) {
        if (form.getAccountLogId() == null) {
            form.setAccountLogId(IdUtil.id());
        }
        return BeanUtil.copyProperties(form, AccountLogManageInfo.class);
    }

    public static AccountLogManageInfo convertToInfo(AccountLogManageEditForm form) {
        return BeanUtil.copyProperties(form, AccountLogManageInfo.class);
    }
}